SQL::DatabaseSnapshot Example: Selected Tables

Description

Deals with issues of flexibility of the objects in SQL::DatabaseSnapshot.

Because of the flexibility of the objects in SQL::DatabaseSnapshot, there are likely to be several ways to solve any problem. In this case we will use the SQL::Schema object to get the definitions of all of the tables and then remove one table from the schema object. We will then snapshot the remaining tables using the schema as a reference.

dim cn as SQL::Connection
dim sn as SQL::DatabaseSnapshot
dim sc as SQL::Schema

' Open the source database
cn.open("::Name::MyDatabase")

' Load the schema from the source database
cn.GetSchema(sc)

' Remove one of the tables from the schema
sc.DeleteTable(sc.TableNumber("MeetingNote"))

' Take a snapshot of schema tables
sn.load(cn, sc)

' Save the snapshot as XML
file.from_string("<MyFile>", sn.XML)\